DIR = $(SRC_TOOLS_DIR)
FLAG += -fpic -shared
FILES := $(foreach dir,$(DIR),$(wildcard $(dir)/*.c))
FILENDIR := $(notdir $(FILES))
OBJS = $(patsubst %,$(BUILD_DIR)/%,$(patsubst %c,%o, $(FILENDIR)))
TARGET = $(patsubst %.c,lib%.so,$(notdir $(foreach dir, $(DIR), $(wildcard $(dir)/*.c))))

# $(shell echo $(TARGET) > a.txt)  # 调试

$(LIB_DIR)/$(TARGET): $(OBJS)
	$(CC) $(FLAG) -o $@ $^

$(OBJS): $(BUILD_DIR)/%.o: %.c
	$(CC) $(FLAG) $(INCLUDE) -c -o $@ $^